<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Spark Configuration</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="application-name" content="Spark View Config" />
<link rel="apple-touch-icon" href="rdp.png" />
<meta name="application-name" content="Spark View Config" />
<link rel="SHORTCUT ICON" href="rdp.ico" />
<link rel="icon" href="rdp32.png" sizes="32x32" />
<link rel="icon" href="rdp48.png" sizes="48x48" />
<link rel="stylesheet" href="hi5.css" />
<script type="text/javascript" src="resource.js"></script>
<script type="text/javascript" src="hi5_min.js"></script>
<script type="text/javascript" src="config_min.js"></script>

<style type="text/css">
article {
	display: block;
	margin: 10px;
	padding: 10px;
	font: normal 13px Verdana, Arial, 'Bitstream Vera Sans', Helvetica,
		sans-serif;
	display: none;
}

header,h2 {
	padding: 5px;
	font-size: 110%;
	font-family: tahoma, verdana, sans-serif;
	border-bottom: 1px dotted #BBB;
}
</style>
</head>
<body>
<div id="info"></div>
	<article id="conf0">
		<header>
			Gateway:<input type="text" id="gateway" />
		</header>
	</article>

	<article id="conf1">
		<header>
			Spark is running on <span id="sparkAddr"></span> <span id="expect"
				style="display: none">, expected on <span id="expectAddr"></span></span>
		</header>
	</article>
	<article style="display:block">
		<input type="button" value="Start Configuration" onclick="sparkConfig.getAll();" />
		<span id="message"></span>
	</article>
	<div class="tab_all" id="conf3" style="margin-left:20px;display:none">
		<div class="tab">
			<div class="tab_title">
				<span tabIndex="0">Gateway</span> <span tabIndex="1">Server</span><span
					tabIndex="2">User</span>
			</div>
		</div>
		<div class="tab_body">
			<div>
				<header>
					Gateway Configuration (Saved in gateway.conf)<input type="button"
						name="saveGateway" value="Save" onclick="sparkConfig.saveGateway();"/>
				</header>
				<form action="" id="frmGateway">
					<table>
						<tr>
							<td>SSL (https and wss)</td>
							<td><input type="checkbox" name="ssl" /></td>
						</tr>
						<tr>
							<td>Port(Default is 80 or 443(SSL))</td>
							<td><input type="number" name="port" placeholder="80 or 443" /></td>
						</tr>
						<tr>
							<td>Binding Address</td>
							<td><input type="text" name="bindAddr" /></td>
						</tr>
						<tr>
							<td>Network Level Authentication</td>
							<td><input type="checkbox" name="credSSP" /></td>
						</tr>
						<tr>
							<td>Path of License File</td>
							<td><input type="text" name="license" /></td>
						</tr>
						<tr>
							<td>HTML Root Directory</td>
							<td><input type="text" name="html" /></td>
						</tr>
						<tr>
							<td>Default Web Page</td>
							<td><input type="text" name="directoryIndex" placeholder="rdp.html;index.html" /></td>
						</tr>
						<tr>
							<td>Path of Log File</td>
							<td><input type="text" name="logfile" /></td>
						</tr>
						<tr>
							<td>Size of Single Log File(bytes)</td>
							<td><input type="number" name="maxbytes" placeholder="30720000" /></td>
						</tr>
						<tr>
							<td>Maximum number of Log Files</td>
							<td><input type="number" name="maxfiles" placeholder="99" /></td>
						</tr>
						<tr>
							<td>Log HTTP header</td>
							<td><input type="checkbox" name="logHttpHeader" checked="checked"/></td>
						</tr>

						<tr>
							<td>PDF Converter</td>
							<td><input type="text" name="converter"
								value="C:\\Program Files\\gs\\gs9.05\\bin\\gswin64c.exe" /></td>
						</tr>
						<tr>
							<td>PDF Converter Arguments</td>
							<td><input type="text" name="arguments"
								value="-dBATCH -dNOPAUSE -dUseCIEColor -dPDFSETTINGS=/printer -sDEVICE=pdfwrite -q -sOutputFile=%1 %2" /></td>
						</tr>
						<tr>
							<td>Plugin Class</td>
							<td><input type="text" name="arguments" /></td>
						</tr>
						<tr>
							<td>Administration Password (for reporting API etc)</td>
							<td><input type="text" name="password" /></td>
						</tr>
						<tr>
							<td>Temporary directory (for downloading/uploading)</td>
							<td><input type="text" name="tmpdir" /></td>
						</tr>
						<tr>
							<td>Days of temporary files are kept</td>
							<td><input type="number" name="keepDays" value="3" /></td>
						</tr>
						<tr>
							<td>RD Web Access Webfeed</td>
							<td><input type="text" name="webfeed" /></td>
						</tr>
						<tr>
							<td>Session Recording</td>
							<td><select name="recording">
									<option value="0">No Recording</option>
									<option value="1">Recording Graphic only</option>
							</select></td>
						</tr>
						<tr>
							<td>Directory for saving session recordings</td>
							<td><input type="text" name="recdir" /></td>
						</tr>
						<tr>
							<td>Warn user about session recording</td>
							<td><input type="checkbox" name="recwarning" /></td>
						</tr>
						<tr>
							<td>Access Not-In-List computers after logged in</td>
							<td><input type="checkbox" name="accessNotInList" /></td>
						</tr>
						<tr>
							<td>Name of Redirected Drive</td>
							<td><input type="text" name="disk" placeholder="Storage" /></td>
						</tr>
						<tr>
							<td>Name of Redirected Printer</td>
							<td><input type="text" name="printer" placeholder="Remote Printer from Client"/></td>
						</tr>

						<tr>
							<td>Connections are queued(Backlog)</td>
							<td><input type="number" name="backlog" value="50" /></td>
						</tr>
						<tr>
							<td>User Definition File</td>
							<td><input type="text" name="user" placeholder="path of users.json"/></td>
						</tr>
						<tr>
							<td>Server Definition File</td>
							<td><input type="text" name="server" placeholder="path of servers.json"/></td>
						</tr>
					</table>
				</form>
			</div>
			<div>
				<header>
					Server (RDP Host) Configuration (Saved in servers.json)
					<input type="button" name="addServer" value="Add" id="servers.add" onclick="sparkConfig.editServer();"/>
					<input type="button" name="refresh" value="Refresh" onclick="sparkConfig.refreshServers();"/> 
				</header>
				<div id ="servers" class="data-source">
					<label for="servers.type">Type</label> 
					<select name="type" id="servers.type">
							<option value="NORMALLIST">Normal List</option>
							<option value="WHITELIST">White List</option>
							<option value="BLACKLIST">Black List</option>
					</select>
					<label for="servers.display">Visible</label> <input type="checkbox" name="display" id="servers.display" checked />
					<table id="servers.rows" class="table">
						<thead>
							<tr>
							<th scope="col">ID</th>
							<th scope="col">Display Name</th>
							<th scope="col">Server</th>
							<th scope="col">Action</th>
							</tr>
						</thead>
						<tbody>
							<tr style="cursor: pointer">
								<td></td>
								<td></td>
								<td></td>
								<td><img src="view.png" name="view" title="View"><img src="del.png" name="remove" title="Delete"></td>
							</tr>
						</tbody>
					</table>
					<form name="server" id="servers.view" style="display:none" onsubmit="return sparkConfig.saveServer();">
					  <table class="hi5_dialog">
					    <tr><td colspan="2"><input type="submit" value="Save"/></td></tr>
						<tr><td>ID</td><td><input type="text" name="id" id="server.id" required/>
						<tr><td>Display Name</td><td><input type="text" name="displayName" id="server.displayName" required/></td></tr>
						
						<tr><td>Server</td><td><input type="text" name="server" id="server.server"/></td></tr>
						<tr><td>icon</td><td><input type="text" name="icon"/></td></tr>
						<tr><td>User</td><td><input type="text" name="username"/></td></tr>
						<tr><td>Password</td><td><input type="text" name="password"/></td></tr>
						<tr><td>Domain</td><td><input type="text" name="domain"/></td></tr>
						<tr><td></td><td><input type="checkbox" name="console" />Console session</td></tr>
						<tr><td></td><td><input type="checkbox" name="legacyMode" />VirtualBox RDP or xrdp</td></tr>
						<tr><td>Keyboard Layout</td><td><input type="number" name="keyboard" id="server.keyboard"/></td></tr>
						<tr><td>Color depth</td><td><select name="color">
										<option value="8">256</option>
										<option value="15">High color (15 bit)</option>
										<option value="16" selected>High color (16 bit)</option>
										<option value="24">True color (24 bit)</option>
										<option value="32">Highest Quality (32 bit)</option>
								</select></td></tr>
						<tr>
								<td>Start Program on Connection</td>
								<td><input type="text" name="command" /></td>
							</tr>
							<tr>
								<td>Start in following folder</td>
								<td><input type="text" name="directory" /></td>
						</tr>
						<tr>
								<td>RemoteApp Exe or file</td>
								<td><input type="text" name="remoteProgram" /></td>
							</tr>
							<tr>
								<td>RemoteApp Arguments</td>
								<td><input type="text" name="remoteArgs" /></td>
						</tr>
						
						
						<tr><td>Clipboard Redirection</td><td><input type="checkbox" name="mapClipboard"/></td></tr>
						<tr><td>Sound Redirection</td><td>
						<select name="playSound" id="server.playSound">
							<option value="0">Play on this computer</option>
							<option value="1">Do not play</option>
							<option value="2">Play on remote computer</option>
						</select></td></tr>
						<tr><td>Printer Redirection</td><td><input type="checkbox" name="mapPrinter"/></td></tr>
						<tr><td>Session Recording</td><td><select name="sessionRecord">
							<option value="0">No Recording</option>
							<option value="1">Recording Graphic Only</option>
						</select></td></tr>
						<tr><td>Drive Redirection</td><td><input type="checkbox" name="mapDisk" id="server.mapDisk"/></td></tr>
						<tr><td>Drive 0</td><td>
							<table>
								<tr><td>Dos Name</td><td><input type="text" name="dosName0" onchange="document.getElementById('server.mapDisk').checked=true;" /></td></tr>
								<tr><td>Path</td><td><input type="text" name="devicePath0" /></td></tr>
								<tr><td>Actions</td><td><input type="checkbox" name="actUpload0" checked/>Upload<input type="checkbox" value="Download" name="actDownload0" checked/>
								Download<input type="checkbox" name="actRedirect0" checked/>Redirect</td></tr>
							</table>
						</td></tr>
						<tr><td>Drive 1</td><td>
							<table>
								<tr><td>Dos Name</td><td><input type="text" name="dosName1" /></td></tr>
								<tr><td>Path</td><td><input type="text" name="devicePath1" /></td></tr>
								<tr><td>Actions</td><td><input type="checkbox" name="actRedirect1" checked/>Redirect</td></tr>
							</table>
						</td></tr>
						<tr><td>Drive 2</td><td>
							<table>
								<tr><td>Dos Name</td><td><input type="text" name="dosName2"/></td></tr>
								<tr><td>Path</td><td><input type="text" name="devicePath2"/></td></tr>
								<tr><td>Actions</td><td><input type="checkbox" name="actRedirect2" checked/>Redirect</td></tr>
							</table>
						</td></tr>
						<tr><td>Performance Flags</td><td><input type="number" name="performanceflags" value="111" /></td></tr>
						<tr><td>Network Level Authentication</td><td><input type="checkbox" name="credSSP" /></td></tr>
					  </table>
					</form>
				</div>
			</div>
			<div>
				<header>
					User Configuration (Saved in users.json)
					<input type="button" name="addUser" value="Add" id="users.add" onclick="sparkConfig.editUser();"/>
					<input type="button" name="refresh" value="Refresh" onclick="sparkConfig.refreshUsers();"/> 
				</header>
				<table id="users.rows" class="table">
					<thead>
						<tr>
							<th scope="col">Name</th>
							<th scope="col">Password</th>
							<th scope="col">Servers</th>
							<th scope="col">Action</th>
						</tr>
					</thead>
					<tbody>
						<tr style="cursor: pointer">
							<td></td>
							<td></td>
							<td></td>
							<td><img src="view.png" name="view" title="View"><img
								src="del.png" name="remove" title="Delete"></td>
						</tr>
					</tbody>
				</table>
				<form name="user" id="users.view" style="display: none" onsubmit="return sparkConfig.saveUser();">
					<table class="hi5_dialog">
						<tr>
							<td colspan="2"><input type="submit" value="Save"/></td>
						</tr>
						<tr>
							<td>Name</td>
							<td><input type="text" name="name" required/>
						<tr>
							<td>Password</td>
							<td><input type="text" name="password" required/></td>
						</tr>
						<tr>
							<td>Servers</td>
							<td><input type="text" name="servers" size="60" /><br/>Seperated by "," For example: server1,server2]</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
</body>
</html>